05. Calibrating GBM to data

PRDTM2-787 AI Trading C4 L2 Vid5 Calibrating GBM To Data

Calibration of Geometric Brownian Motion to Data

PRDTM2-787 AI Trading C4 L2 Demo 1

Understanding Momentum-Based Trading with Geometric Brownian Motion

Learn how to calibrate Geometric Brownian Motion (GBM) to data for momentum-based trading. GBM is a model for predicting stock prices by considering both deterministic and stochastic elements.

Key Concepts:

  • Geometric Brownian Motion (GBM): A mathematical model used for simulating stock prices, considering the drift (momentum) and volatility.
  • Stochastic Differential Equation (SDE): Describes the change in stock prices, incorporating both drift (mu) and volatility (sigma).
  • Calibration: Adjusting GBM parameters to fit historical stock data, such as the S&P 500 index.

Steps in Calibration:

  1. Import Libraries:

    • Numpy: For numerical calculations.
    • Scipy: For statistical functions, especially normal distribution.
    • CSV and Contextlib: For reading and handling data files.
  2. Define GBM Class:

    • Initialize mu and sigma.
    • Create random number generator for simulation.
  3. Calibration Function:

    • Calculate mean and standard deviation of the log of increments.
    • Derive mu and sigma from these statistics.
  4. Load Data:

    • Read historical S&P 500 index values from a CSV file.
    • Use GBM class to calibrate these data points.
  5. Analysis:

    • Estimated momentum is around 2.2%.
    • Estimated volatility is about 6.7%, indicating market risk.

Upcoming Topics:

  • Discuss options for risk hedging.
  • Explore qualitative risk management strategies.

This learning material provides insights into coding applications for finance. Happy coding!

QUESTION:

Download the daily closing prices of Apple in 2024 from e.g. Yahoo finance. Is GBM a good model for the prices? If it is, calibrate a GBM to the prices.

ANSWER:

Test whether the log-price differences are normally distributed with the Shapiro-Wilk's test. If they are, GBM is probably a good model. Calibrate it to the prices as described in the course video.